#!/usr/bin/perl

use bignum;
$MAX = 1001;

sub s{
	my $d = $_[0];
	if($d == 1) {
		return 1;
	} else {
		return 4*$d*$d - 6*$d + 6 + &s($d-2);
	}
}

print &s(1001),"\n";
